package de.farbstreich.tozen2.client.board;

import java.awt.image.BufferedImage;
import java.io.IOException;

import de.farbstreich.tozen2.common.AePlayWave;
import de.farbstreich.tozen2.common.Tools;

public enum TileEnum {
	TOWER("Tower","shadow.png", "releaseTile.wav", 37), KNIGHT("Knight","shadow.png", "releaseTile.wav",
			37), ARCHER("Bow","shadow.png", "releaseTile.wav", 37);

	public static final int NUMBER_OF_COLORS = 4;
	private BufferedImage[] images;
	private BufferedImage shadow;
	private String waveFile;
	private int size;

	TileEnum(String fn, String sh, String waveFile, int size) {
		this.waveFile = waveFile;
		this.size = size;
		images = new BufferedImage[4];
		try {
			this.shadow = Tools.loadImage(sh);
			for (int i = 0; i < NUMBER_OF_COLORS; i++)
				images[i] = Tools.loadImage("u" + i + "_" + fn + ".png");

		} catch (IOException e) {
			e.printStackTrace();

		} catch (Exception e) {
			e.printStackTrace();
		}
	}

	public BufferedImage getImage(int playerId) {
		return this.images[playerId];
	}

	public BufferedImage getShadowImage() {
		return this.shadow;
	}
	
	public void playSound() {
		(new AePlayWave(waveFile)).start();
	}

	public int getSize() {
		return this.size;
	}
}
